package com.wolfheader.wolfgame.entity;

import javax.persistence.Entity;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Entity - 玩家用户
 * 
 * @author 8615 Team
 * @version 1.0
 */
@Entity
@Table(name = "t_member")
public class MemberEntity extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8623488397834922209L;

	/**
	 * 唯一ID
	 */
	private String openid;

	/**
	 * 用户昵称
	 */
	private String nickname;

	/**
	 * 头像
	 */
	private String headimgurl;

	/**
	 * 用户的性别，值为1时是男性，值为2时是女性，值为0时是未知
	 */
	private String sex;

	/**
	 * 城市
	 */
	private String city;

	/**
	 * 省份
	 */
	private String province;

	/**
	 * 国家
	 */
	private String country;

	/**
	 * 游玩次数
	 */
	private Integer playCount;

	/**
	 * 电话
	 */
	private String phone;

	/**
	 * 真名
	 */
	private String realname;

	/**
	 * 地址
	 */
	private String address;

	/**
	 * 登录token
	 */
	private String token;

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	@JsonProperty
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@JsonProperty
	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	@JsonProperty
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Integer getPlayCount() {
		return playCount;
	}

	public void setPlayCount(Integer playCount) {
		this.playCount = playCount;
	}

	@JsonProperty
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	@JsonProperty
	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@JsonProperty("avatar")
	public String getHeadimgurl() {
		return headimgurl;
	}

	public void setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	/**
	 * 持久化前处理
	 */
	@PrePersist
	public void prePersist() {
		setPhone("");
		setAddress("");
		setRealname("");
	}
}
